{% extends 'main.html' %}
{% load i18n %}
{% block tags%}
<div id="tags">
    <h3>{% trans "Tags" %}:</h3>
    <h4>        
        {% for tag in tags %}
            <a href="/main/notes/?tag={{tag.key.id}}">{{tag.name}}({{tag.notetag_set.count}})</a>
            &nbsp;&nbsp;
        {% endfor %}
    </h4>
</div>
{% endblock tags%}

{% block comments %}
<div class="comment">
	  <h3>{% trans 'Recent Comments' %}:</h3>
	  
	{% for comment in noteComments %}
	  <p>
	  <strong>{{comment.name|escape}}:</strong><a href="/main/note/?id={{comment.note.key.id}}">{{comment.content|escape}}</a>
	  </p>
	{% endfor %}
</div>
{% endblock comments %}


{% block content %}
    <div id="detail" >
        <h3>
                  &nbsp;{% trans 'Categories' %}:&nbsp;&nbsp;
                  <a href="/">
                  {% trans 'All' %}
                  </a>
              
                  {% for category in categories %}
                      &nbsp;&nbsp;
                      <a href="/?category={{category.key.id}}" title="{{category.describe}}">
                      {{category.name}}
                      </a>({{category.note_set.count}})
                  {% endfor %}
        </h3>
    {% for note in data %}
      <div class="post">
      <h1>
         <a href="/main/note/?id={{note.key.id}}">
         {{note.title}}
         </a>
      </h1>
      <h5>
          {{note.createTime|date:"Y-m-d H:i:s"}}&nbsp;&nbsp;
          {% trans "Category" %}:<a href="/?category={{note.jumCategory.key.id}}">{{note.jumCategory.name}}</a>&nbsp;&nbsp;
          {% trans "Comments" %}:{{note.notecomment_set.count}}&nbsp;&nbsp;
          {% trans "Reference" %}:{{note.trackback_set.count}}&nbsp;&nbsp;
          {% trans "Tags" %}:
            {% for notetag in note.notetag_set %}
              {% if not forloop.first %}
              ,
              {% endif %}
                <a href="/main/notes/?tag={{notetag.tag.key.id}}">{{notetag.tag.name}}</a>
            {% endfor %}
        </h5>
        <p>{{note.content}}</p>
        <h5>{% trans 'TrackBack URL' %}:{{config.siteHome}}feeds/trackBack/{{note.key.id}}/</h5>
        </div>
    {% endfor %}
    	
    	{% if page and page.has_other_pages %}
    	<div class="pagination">
    		<h3>
    			{% if page.has_previous %}
    				<a href="/?page={{page.previous_page_number}}">{% trans "Previous" %}</a>
    			{% else %}
    				{% trans "Previous" %}
    			{% endif %}
    			&nbsp;&nbsp;
    			{% if page.has_next %}
    				<a href="/?page={{page.next_page_number}}">{% trans "Next" %}</a>
    			{% else %}
    				{% trans "Next" %}
    			{% endif %}
    			&nbsp;&nbsp;&nbsp;&nbsp;
    			{{ page.number }}&nbsp;of&nbsp;{{ page.paginator.num_pages }}
    		</h3>
    	</div>
    	{% endif %}
    </div>
{% endblock content %}
